package com.bbx.taxi.client.Task;

import java.util.List;

import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;

import com.bbx.androidapi.util.SharedPreUtil;
import com.bbx.androidapi.util.ToastUtil;
import com.bbx.api.sdk.model.passanger.CouponCountBuild;
import com.bbx.api.sdk.model.passanger.PriceAllBuild;
import com.bbx.api.sdk.model.passanger.WeightOrVolumnBuild;
import com.bbx.api.sdk.model.passanger.Return.Elements;
import com.bbx.api.sdk.model.passanger.Return.PriceAll;
import com.bbx.api.sdk.model.passanger.Return.PriceAll.PriceAllDetail;
import com.bbx.api.sdk.net.base.BaseNetwork;
import com.bbx.api.sdk.net.base.JsonBuild;
import com.bbx.api.sdk.net.passeger.conn.CancelReasonListNet;
import com.bbx.api.sdk.net.passeger.conn.CouponCountNet;
import com.bbx.api.sdk.net.passeger.conn.PriceAllNet;
import com.bbx.api.sdk.net.passeger.conn.WeightNet;
import com.bbx.taxi.client.Activity.Main.MainActivity;
import com.bbx.taxi.client.Bean.Attribute.MainAttribute;
import com.bbx.taxi.client.Bean.Attribute.MainAttribute.CjType;
import com.bbx.taxi.client.Bean.Message.ObserverListener.DATA_TYPE;
import com.bbx.taxi.client.Task.BaseAsyncTask;
import com.bbx.api.util.SharedPreEncryptUtil;
import com.bbx.taxi.client.MyApplication;
import com.bbx.taxi.client.R;
/** 
 * @Path com.bbx.taxi.client.Task.MyPriceAllTask.java
 * @Author 严旭文
 * @Date 2016-6-12 下午6:08:37
 * @Company 蓝海（福建）信息技术有限公司
 * 城内城际所有线路价格(客户端使用)
 */
public class MyPriceAllTask extends BaseTask{
    public DATA_TYPE TYPE=DATA_TYPE.PRICEALL;
    private PriceAllBuild mPriceAllBuild;
	/** 用于判断是否是当前的类型，城际，市内，快件 */
	private int view_id;
	/** 判断拼车，包车，顺风车 */
	private CjType citype;
	public MyPriceAllTask(Activity context,List<Elements> elements,String appoint_time,int view_id,
			CjType citype) {
		super(context);
		this.view_id = view_id;
		this.citype = citype;
		mPriceAllBuild = new PriceAllBuild(context);
		mPriceAllBuild.uid =  MyApplication.getInstance().getUid();
		mPriceAllBuild.access_token = MyApplication.getInstance().getToken();
		mPriceAllBuild.elements = elements;
		mPriceAllBuild.appoint_time=appoint_time;
	}
	@Override
	public boolean isShow() {
		return false;
	}

	@Override
	public boolean isReturnString() {
		return false;
	}
	@Override
	public boolean condition() {
		try {
			MainActivity mainactivity = (MainActivity) context;
			MainAttribute main = MainAttribute.getInstance();
			if (mainactivity.mPresenter.getViewId() == view_id
					&& main.getCjType() == citype) {
				return true;
			} else {
				return false;
			}
		} catch (Exception e) {

			return true;
		}
	}
	@Override
	public void request() {
		setType(TYPE,mPriceAllBuild);
	}
	@Override
	public void success(int status,Object object) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void failed(int status, String msg,String message) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public BaseNetwork getBaseNetwork() {
		return new PriceAllNet(context);
	}
}
